package a.f.h.b;

import a.c.d;
import a.c.e;
import a.c.k;
import a.c.*;
import a.f.j.n;
import a.f.j.o;

public class h
{
  f a;
  q c;
  public static int d;
  
  public void a(f paramf, k paramk)
  {
    int i7 = f.m;
    boolean bool = f.l;
    this.a = paramf;
    this.c = paramf.a();
    Object localObject1 = paramf.c();
    Object localObject2;
    Object localObject3;
    Object localObject4;
    label220:
    label501:
    do
    {
      if (!((o)localObject1).e()) {
        break;
      }
      localObject2 = null;
      localObject3 = ((o)localObject1).a();
      localObject4 = ((n)localObject3).a();
      int i = 0;
      int j = 0;
      int k = 0;
      int m = 0;
      Object localObject5;
      do
      {
        do
        {
          if (!((m)localObject4).e()) {
            break;
          }
          localObject5 = ((m)localObject4).a();
          if (bool) {
            break label220;
          }
          if (((d)localObject5).e().c() == 4)
          {
            i++;
            if (i7 != 0) {
              continue;
            }
            if (!bool) {}
          }
          else if (i7 == 0)
          {
            if (((d)localObject5).e().c() == 6)
            {
              j++;
              if (i7 != 0) {
                continue;
              }
              if (localObject2 == null)
              {
                localObject2 = localObject5;
                m = 6;
                if (i7 != 0) {
                  continue;
                }
                if (!bool) {}
              }
            }
            else
            {
              if (i7 != 0) {
                continue;
              }
            }
          }
          else if (((d)localObject5).e().c() > m)
          {
            localObject2 = localObject5;
            m = ((d)localObject5).e().c();
          }
          k++;
          ((m)localObject4).f();
        } while (!bool);
      } while (i7 != 0);
      if (k > 4) {}
      if ((i7 != 0) || ((i > 0) || ((i7 != 0) || (j > 0))))
      {
        localObject5 = new d[k];
        int n = 0;
        int i1 = 0;
        Object localObject6 = null;
        m localm = ((n)localObject3).a();
        if ((i7 != 0) || (localObject2 != null)) {}
        while (i7 != 0) {
          do
          {
            if (localm.a() == localObject2) {
              break;
            }
            if (i7 != 0) {
              break label324;
            }
            localm.b();
            if (bool) {
              break label322;
            }
          } while (!bool);
        }
        localm.c();
        Object localObject7 = localm.a();
        localObject6 = paramf.b(paramf.a((d)localObject7));
        localm.b();
        int i2 = 0;
        do
        {
          do
          {
            if (i2 >= k) {
              break;
            }
            d locald = localm.a();
            int i3 = locald.e().c();
            n localn = paramf.b(paramf.a(locald));
            if (i7 != 0) {
              break label711;
            }
            if (bool) {
              break label709;
            }
            if ((i7 != 0) || (paramk != null)) {
              if (i7 != 0) {}
            }
            int i4 = paramk.getBool(locald) ? 1 : 0;
            int i5 = paramf.e(locald) - 2;
            if (i7 == 0) {
              if (i5 >= -1) {
                if (i7 != 0) {
                  break label466;
                }
              }
            }
            int i6 = i5 > 1 ? 1 : 0;
            if (localn == localObject6)
            {
              if (i7 != 0) {
                break label501;
              }
              if (i4 == 0)
              {
                if (i7 != 0) {
                  break label536;
                }
                if (i6 == 0) {
                  break label534;
                }
              }
            }
            if (i7 == 0)
            {
              if (n > 0) {
                a(paramk, (d[])localObject5, n, i1, (n)localObject3, (n)localObject6);
              }
              n = 0;
            }
            i1 = 0;
            localObject6 = localn;
            if (i7 == 0) {
              if (i6 == 0)
              {
                if (i7 == 0) {
                  if (n != 0)
                  {
                    if (i7 != 0) {
                      break label579;
                    }
                    if (i3 != 4)
                    {
                      if (i7 != 0) {
                        break label626;
                      }
                      if (i3 != 6) {
                        break label624;
                      }
                    }
                  }
                }
                if (i7 != 0) {
                  break label626;
                }
                if (i4 == 0)
                {
                  if (i7 == 0)
                  {
                    if (n > 0) {
                      i1 += i5;
                    }
                    localObject5[(n++)] = locald;
                  }
                  if (i7 != 0) {
                    continue;
                  }
                  if (!bool) {
                    break label659;
                  }
                }
              }
            }
            if (i7 == 0)
            {
              if (n > 0) {
                a(paramk, (d[])localObject5, n, i1, (n)localObject3, (n)localObject6);
              }
              n = 0;
            }
            i1 = 0;
            localObject6 = localn;
            localObject7 = locald;
            localm.b();
            i2++;
          } while (!bool);
        } while (i7 != 0);
        if (n > 0) {
          a(paramk, (d[])localObject5, n, i1, (n)localObject3, (n)localObject6);
        }
      }
      ((o)localObject1).f();
    } while (!bool);
    label322:
    label324:
    label466:
    label624:
    label626:
    localObject1 = this.c.v();
    label534:
    label536:
    label579:
    label709:
    label711:
    do
    {
      if (!((w)localObject1).e()) {
        break;
      }
      localObject2 = ((w)localObject1).d();
      if (i7 == 0)
      {
        if (((e)localObject2).c() == 4)
        {
          localObject3 = ((e)localObject2).h();
          localObject4 = ((e)localObject2).j();
          if (i7 != 0) {
            continue;
          }
          if (paramf.b((d)localObject3) == paramf.b((d)localObject4))
          {
            paramf.a((d)localObject3, 2);
            paramf.a((d)localObject4, 2);
          }
        }
        ((w)localObject1).f();
      }
    } while (!bool);
    label659:
  }
  
  private final void a(k paramk, d[] paramArrayOfd, int paramInt1, int paramInt2, n paramn1, n paramn2)
  {
    int i1 = f.m;
    boolean bool = f.l;
    if (paramInt1 <= 1) {
      return;
    }
    d locald1 = paramArrayOfd[0];
    if (i1 == 0) {}
    Object localObject = locald1.k() == null ? locald1.e().j() : locald1.k();
    if (i1 == 0) {
      if ((this.a.b((d)localObject) != paramn2) && ((i1 != 0) || (locald1.e().c() == 6)))
      {
        if (i1 == 0) {}
        localObject = ((d)localObject).k() == null ? ((d)localObject).e().j() : ((d)localObject).k();
      }
    }
    if (this.a.b((d)localObject) == paramn2) {
      label136:
      do
      {
        if (paramInt2 >= 0) {
          break;
        }
        break;
        if (bool) {
          break label243;
        }
        if (this.a.e(locald1) <= 1) {
          break;
        }
        if (i1 != 0) {
          break label230;
        }
        if (this.a.e((d)localObject) >= 3) {
          break;
        }
        paramInt2++;
        this.a.a(locald1, this.a.e(locald1) - 1);
        this.a.a((d)localObject, this.a.e((d)localObject) + 1);
      } while (!bool);
    }
    label230:
    label243:
    do
    {
      break label307;
      if (i1 != 0) {
        break label136;
      }
      if ((paramInt2 > 0) && (this.a.e((d)localObject) > 1)) {
        if (i1 == 0)
        {
          if (this.a.e(locald1) < 3)
          {
            paramInt2--;
            this.a.a(locald1, this.a.e(locald1) + 1);
            this.a.a((d)localObject, this.a.e((d)localObject) - 1);
          }
        }
        else {
          if (!bool) {
            break;
          }
        }
      }
      locald1 = paramArrayOfd[(paramInt1 - 1)];
    } while (i1 != 0);
    label307:
    localObject = locald1.f();
    d locald2 = this.a.a(locald1);
    d locald3 = ((e)localObject).h();
    if (this.a.b(locald3) != paramn1) {}
    while (i1 != 0)
    {
      locald3 = locald3.i();
      if ((i1 == 0) && (bool)) {
        break label594;
      }
      if (!bool) {
        break;
      }
    }
    if ((locald3 != locald1) && (this.a.b(locald2) == paramn2)) {
      do
      {
        if (paramInt2 >= 0) {
          break;
        }
        break;
        if (bool) {
          break label525;
        }
        if (this.a.e(locald3) <= 1) {
          break;
        }
        if (i1 != 0) {
          break label507;
        }
        if (this.a.e(locald2) >= 3) {
          break;
        }
        paramInt2++;
        this.a.a(locald3, this.a.e(locald3) - 1);
        this.a.a(locald2, this.a.e(locald2) + 1);
      } while (!bool);
    }
    label507:
    while (i1 != 0) {
      do
      {
        for (;;)
        {
          break;
          if (i1 == 0)
          {
            if (paramInt2 <= 0) {
              break label594;
            }
            if (bool) {
              break label600;
            }
            if (this.a.e(locald2) <= 1) {
              break label594;
            }
            if (i1 != 0) {
              break label591;
            }
            if (this.a.e(locald3) >= 3) {
              break label594;
            }
            paramInt2--;
            this.a.a(locald3, this.a.e(locald3) + 1);
            this.a.a(locald2, this.a.e(locald2) - 1);
          }
        }
      } while (!bool);
    }
    label525:
    label591:
    label594:
    label600:
    int i = 1;
    label783:
    label788:
    label884:
    label1021:
    do
    {
      do
      {
        if (i >= paramInt1) {
          break;
        }
        localObject = paramArrayOfd[i].e();
        if (i1 == 0)
        {
          locald2 = paramArrayOfd[i];
          if (bool) {
            return;
          }
        }
        if (i1 == 0) {}
        locald3 = locald2.k() == null ? ((e)localObject).j() : locald2.k();
        if (i1 == 0) {
          if (this.a.b(locald3) != paramn2) {
            throw new IllegalStateException("Wrong face!");
          }
        }
        int j = this.a.e(locald2);
        if (i1 == 0) {
          if (paramInt2 < 0)
          {
            paramInt2++;
            k = 1;
            if (i1 != 0) {
              break label788;
            }
            if (!bool) {
              break label783;
            }
          }
        }
        if (i1 == 0) {
          if (paramInt2 > 0)
          {
            if (i1 == 0) {
              if (((e)localObject).c() == 4)
              {
                paramInt2--;
                k = 3;
                if (i1 != 0) {
                  break label788;
                }
                if (!bool) {
                  break label783;
                }
              }
            }
            k = 2;
            if (i1 != 0) {
              break label788;
            }
            if (!bool) {
              break label783;
            }
          }
        }
        int k = 2;
        int m = k - j;
        if (i1 == 0)
        {
          if (m != 0)
          {
            int n = this.a.e(locald3);
            if (i1 == 0) {
              if (n - m >= 1)
              {
                if (i1 != 0) {
                  break label884;
                }
                if (n - m < 4)
                {
                  this.a.a(locald3, n - m);
                  this.a.a(locald2, j + m);
                  if (i1 != 0) {
                    continue;
                  }
                  if (!bool) {
                    break label1041;
                  }
                }
              }
            }
            if (((e)localObject).c() == 6)
            {
              if (i1 == 0) {}
              locald3 = locald3.k() == null ? ((e)localObject).j() : locald3.k();
              if (i1 == 0) {
                if (this.a.b(locald3) != paramn2) {
                  throw new IllegalStateException("Wrong face!");
                }
              }
              n = this.a.e(locald3);
              if (i1 == 0)
              {
                if (n - m < 1) {
                  break label1021;
                }
                if (i1 != 0) {}
              }
              else
              {
                if (n - m >= 4) {
                  break label1021;
                }
                this.a.a(locald3, n - m);
                this.a.a(locald2, j + m);
              }
              if (i1 != 0) {
                continue;
              }
              if (bool) {
                throw new IllegalStateException("Could not assign new angle!");
              }
            }
            else
            {
              throw new IllegalStateException("Incompatible degree!");
            }
          }
          i++;
        }
      } while (!bool);
    } while (i1 != 0);
    label1041:
    if (paramInt2 != 0) {
      throw new IllegalStateException("Could not compensate directions changes.");
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.h.b.h

 * JD-Core Version:    0.7.0.1

 */